package com.mes.service.cb;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.mes.dao.cb.OrdersMapper;
import com.mes.entity.cb.Order;
import com.mes.entity.cb.PageBean;

/**
 * 订单
 * @ClassName: OrderServiceImpl 
 * @Description:
 * @Author cb
 * @Date 2018年1月15日 下午4:12:58 
 * @version 1.0
 */
@Service
@Transactional
public class OrderServiceImpl implements OrderService {

	@Resource
	private OrdersMapper  ordersMapper;
	
	@Override
	public int order_insert(Order order) {
		return ordersMapper.order_insert(order);
	}
	/*@Resource
	private OrderMapper oderMapper;

	@Override
	public int order_insert(Order order) {
		return oderMapper.order_insert(order);
	}*/

	@Override
	public boolean selectOrderBynumber(String order_number) {
		
		Long id=ordersMapper.selectOrderBynumber(order_number);
		
		if (id != null) {
			return true;
		} else {

			return false;
		}
	}

	@Override
	public List<Order> order_list(PageBean pages) {
		return ordersMapper.order_list(pages);
	}

	@Override
	public int order_total(PageBean pages) {
		return ordersMapper.order_total(pages);
	}

	@Override
	public int order_Delete(String number) {
		return ordersMapper.order_Delete(number);
	}

	@Override
	public int order_updateByState(Map<String, Object> map) {
		return ordersMapper.order_updateByState(map);
	}

	@Override
	public Order order_ByTaskId(String processInstanceId) {

		List<Order> list = ordersMapper.order_ByTaskId(processInstanceId);

		if (list.size() > 0) {
			return list.get(0);
		}

		return null;
	}

	@Override
	public int order_updateSupperBynumber(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return ordersMapper.order_updateSupperBynumber(map);
	}




}
